{include file="common_header.tpl"}

{literal}
<script type="text/javascript">
	function validate()
	{
		var fields =$('#d_username').attr('value') == "" ||
					$('#d_displayname').attr('value') == "" ||
					$('#d_firstname').attr('value') == "" ||
					$('#d_lastname').attr('value') == "" ||
					$('#d_email').attr('value') == "";
					
		var passwords =	$('#d_password').attr('value') != "" &&
						$('#d_password').attr('value') == 
						$('#d_password2').attr('value');
		
		if ($('#d_password').attr('value') == "")
		{	$('#password_verify').html(""); }
		else if (passwords)
		{	$('#password_verify').html("<font color='green'><b>OK</b></font>"); }
		else
		{	$('#password_verify').html("<font color='red'><b>Passwords don't match.</b></font>"); }
		
		if(	fields )
			{
				$('#submit').attr('disabled',true);
			}
		else
			{
				$('#testconnection').attr('disabled',false);
				if (!fields && passwords)
					{$('#submit').attr('disabled',false);}
				else
					{$('#submit').attr('disabled',true);}
			}
	}

	$("document").ready(function() 
	{
		$('#register').keyup(validate);
		$('#register').mouseup(validate);
	});
</script>
{/literal}

{if $reg_attempt}
	<br/>Registration info detected... 
	{if $reg_success}
		<font color="#009900">registration successful</font>
	{else}
		<font color="#990000">registration failed</font>
	{/if}
{else}
	<b>Register</b>
	<form id="register" method="post" action="register.php">
	<table>
		<tr><td style="text-align:right">Name:</td>			<td><input id="d_username" type="text" name="username" /></td></tr>
		<tr><td style="text-align:right">Display Name:</td>	<td><input id="d_displayname" type="text" name="displayname"/></td></tr>
		<tr><td style="text-align:right">First Name:</td>	<td><input id="d_firstname" type="text" name="firstname"/></td></tr>
		<tr><td style="text-align:right">Last Name:</td>		<td><input id="d_lastname" type="text" name="lastname"/></td></tr>
		<tr><td style="text-align:right">Password:</td>		<td><input id="d_password" type="password" name="password"/></td></tr>
		<tr><td style="text-align:right">(again):</td>		<td><input id="d_password2" type="password" name="password2"/> <span id="password_verify"></span></td></tr>
		<tr><td style="text-align:right">Email:</td>			<td><input id="d_email" type="text"  name="email"/></td></tr>
		<tr><td></td>				<td><input id="submit" type="submit" value="Register" disabled="true"/></td></tr>
	</table>
	</form>
{/if}

{include file="common_footer.tpl"}